﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
namespace OracleDAL.StatSheme
{
    public class shemeShowResult
    {
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  DISTINCT SHEMEID,STATCONDITION,STATTYPE,RESID,RESBELONG,RESBELONGNAME,STATITEMID,STATITEMNAME,LEVELCODE,BELONGOPEREAT");
            strSql.Append(" FROM COM_STATISTICS_SHEME_OPERATE ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DBUtility.OracleHelper.Query(strSql.ToString());
        }
        public DataSet GetListPriview(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select DISTINCT SHEMEID,STATCONDITION,STATTYPE,RESID,RESBELONG,RESBELONGNAME,STATITEMID,STATITEMNAME,LEVELCODE");
            strSql.Append(" FROM COM_STATISTICS_SHEME_PRIVIEW");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DBUtility.OracleHelper.Query(strSql.ToString());
        }
        public DataSet getValue(string sql)
        {
            return DBUtility.OracleHelper.Query(sql.ToString());
        }
        public string getMaxValue(string sql)
        {
            string str = "";
            OracleDataReader dr = DBUtility.OracleHelper.ExecuteReader(sql);

            if (dr.Read())
            {
                str = dr["max"].ToString();
            }
            dr.Close();
            return str;
        }
        public int excuteSql(string sql)
        {
            return DBUtility.OracleHelper.ExecuteSql(sql);
        }
    }
}
